﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaiTu.EventServices.Factory
{
    public static class BaiTuSocketFactory
    {
        /// <summary>
        /// 获得一个A2DTcpSocket对象（不用考虑是否连接到了服务器，会自动建立连接、retry connect）
        /// </summary>
        /// <returns></returns>
        //public static A2DTcpBroker GetA2DSocketClient()
        //{
        //    string serverIp = Configuration.EventServiceConfiguration.SuperSocketSettings.Address;
        //    int serverPort = Configuration.EventServiceConfiguration.SuperSocketSettings.Port;
        //    double retryInterval = Configuration.EventServiceConfiguration.SuperSocketSettings.RetryConnectInterval;


        //    var funcPerConnected = new Action<A2DTcpBroker>((client) =>
        //    {
        //        client.Send(Helper.GenerateDeclareCommand(Configuration.EventServiceConfiguration.SuperSocketSettings.Identifier));
        //        client.AttachEvent(Starter.eventResolver.Resolve);

        //        Starter.RegisterEvents();
        //    });

        //    return A2DTcpClientManager.GetClientSocket(serverIp, serverPort, retryInterval, funcPerConnected);
        //}
    }
}
